<h1>Detail Statement Bonus</h1>
<?php
$this->renderPartial('application.modules.member.views.main.info');
?>
<br />
<h2>Detail Statement Bonus Anda Per <?php echo function_lib::convert_datetime($data['date'], 'text', '', ':', 'ina'); ?></h2>
<div class="list">
    <table cellpadding="0" cellspacing="0">
        <tr>
            <th colspan="2">Data Index Harian</th>
        </tr>
        <tr>
            <td width="120">Tanggal</td>
            <td><?php echo function_lib::convert_datetime($data['date'], 'text', '', ':', 'ina'); ?></td>
        </tr>
        <tr>
            <td>Index</td>
            <td><?php echo $percent['index']; ?> %</td>
        </tr>
        <tr>
            <td>PPh</td>
            <td>3.00 %</td>
        </tr>
        <tr>
            <td>Administration Fee</td>
            <td><?php echo (strtotime($data['date']) < strtotime('2011-12-01')) ? '0.00' : '7.00'; ?> %</td>
        </tr>
    </table>
</div>
<br />
<?php
$pph = $adm = array(
    'sponsor' => 0,
    'extra_sponsor' => 0,
    'gen_node_products' => 0,
    'gen_node' => 0,
    'match' => 0,
    'gen_match' => 0,
    'matrix_node' => 0,
    'gen_node_extra' => 0,
    'board_level' => 0,
    'board_fly' => 0,
    'sponsor_upgrade' => 0,
);
if(strtotime($data['date']) < strtotime('2011-12-01')) {
    $pph = $cut_adm;
} else {
    $pph['sponsor'] = 0.3 * $cut_adm['sponsor'];
    $pph['extra_sponsor'] = 0.3 * $cut_adm['extra_sponsor'];
    $pph['gen_node_products'] = 0.3 * $cut_adm['gen_node_products'];
    $pph['gen_node'] = 0.3 * $cut_adm['gen_node'];
    $pph['match'] = 0.3 * $cut_adm['match'];
    $pph['gen_match'] = 0.3 * $cut_adm['gen_match'];
    $pph['matrix_node'] = 0.3 * $cut_adm['matrix_node'];
    $pph['gen_node_extra'] = 0.3 * $cut_adm['gen_node_extra'];
    $pph['gen_node_extra_warehouse'] = 0.3 * $cut_adm['gen_node_extra_warehouse'];
    $pph['board_level'] = 0.3 * $cut_adm['board_level'];
    $pph['board_fly'] = 0.3 * $cut_adm['board_fly'];
    $pph['sponsor_upgrade'] = 0.3 * $cut_adm['sponsor_upgrade'];
    
    $adm['sponsor'] = $cut_adm['sponsor'] - $pph['sponsor'];
    $adm['extra_sponsor'] = $cut_adm['extra_sponsor'] - $pph['extra_sponsor'];
    $adm['gen_node_products'] = $cut_adm['gen_node_products'] - $pph['gen_node_products'];
    $adm['gen_node'] = $cut_adm['gen_node'] - $pph['gen_node'];
    $adm['match'] = $cut_adm['match'] - $pph['match'];
    $adm['gen_match'] = $cut_adm['gen_match'] - $pph['gen_match'];
    $adm['matrix_node'] = $cut_adm['matrix_node'] - $pph['matrix_node'];
    $adm['gen_node_extra'] = $cut_adm['gen_node_extra'] - $pph['gen_node_extra'];
    $adm['gen_node_extra_warehouse'] = $cut_adm['gen_node_extra_warehouse'] - $pph['gen_node_extra_warehouse'];
    $adm['board_level'] = $cut_adm['board_level'] - $pph['board_level'];
    $adm['board_fly'] = $cut_adm['board_fly'] - $pph['board_fly'];
    $adm['sponsor_upgrade'] = $cut_adm['sponsor_upgrade'] - $pph['sponsor_upgrade'];
}
$total_pph = array_sum($pph);
$total_adm = array_sum($adm);
?>
<div class="list">
    <table cellpadding="0" cellspacing="0">
        <tr>
            <th>Jenis Bonus</th>
            <th width="80">Bonus</th>
            <th width="60">Index</th>
            <th width="80">Subtotal</th>
            <th width="60">PPh</th>
            <th width="60">Adm Fee</th>
            <th width="80">Total</th>
        </tr>
        <tr>
            <td><strong>Bonus Sponsor</strong></td>
            <td align="right"><?php echo number_format($bonus['sponsor']); ?></td>
            <td align="right" style="color:#880000;"><?php echo number_format($cut_index['sponsor']); ?></td>
            <td align="right"><?php echo number_format($subtotal['sponsor']); ?></td>
            <td align="right" style="color:#880000;"><?php echo number_format($pph['sponsor']); ?></td>
            <td align="right" style="color:#880000;"><?php echo number_format($adm['sponsor']); ?></td>
            <td align="right"><strong><?php echo number_format($total['sponsor']); ?></strong></td>
        </tr>
        <tr>
            <td><strong>Bonus Extra Sponsor</strong></td>
            <td align="right"><?php echo number_format($bonus['extra_sponsor']); ?></td>
            <td align="right" style="color:#880000;"><?php echo number_format($cut_index['extra_sponsor']); ?></td>
            <td align="right"><?php echo number_format($subtotal['extra_sponsor']); ?></td>
            <td align="right" style="color:#880000;"><?php echo number_format($pph['extra_sponsor']); ?></td>
            <td align="right" style="color:#880000;"><?php echo number_format($adm['extra_sponsor']); ?></td>
            <td align="right"><strong><?php echo number_format($total['extra_sponsor']); ?></strong></td>
        </tr>
        <tr>
            <td><strong>Bonus Royalti Produk</strong></td>
            <td align="right"><?php echo number_format($bonus['gen_node_products']); ?></td>
            <td align="right" style="color:#880000;"><?php echo number_format($cut_index['gen_node_products']); ?></td>
            <td align="right"><?php echo number_format($subtotal['gen_node_products']); ?></td>
            <td align="right" style="color:#880000;"><?php echo number_format($pph['gen_node_products']); ?></td>
            <td align="right" style="color:#880000;"><?php echo number_format($adm['gen_node_products']); ?></td>
            <td align="right"><strong><?php echo number_format($total['gen_node_products']); ?></strong></td>
        </tr>
        <tr>
            <td><strong>Bonus Prestasi Distributor</strong></td>
            <td align="right"><?php echo number_format($bonus['gen_node']); ?></td>
            <td align="right" style="color:#880000;"><?php echo number_format($cut_index['gen_node']); ?></td>
            <td align="right"><?php echo number_format($subtotal['gen_node']); ?></td>
            <td align="right" style="color:#880000;"><?php echo number_format($pph['gen_node']); ?></td>
            <td align="right" style="color:#880000;"><?php echo number_format($adm['gen_node']); ?></td>
            <td align="right"><strong><?php echo number_format($total['gen_node']); ?></strong></td>
        </tr>
        <tr>
            <td><strong>Bonus Couple/Pasangan</strong></td>
            <td align="right"><?php echo number_format($bonus['match']); ?></td>
            <td align="right" style="color:#880000;"><?php echo number_format($cut_index['match']); ?></td>
            <td align="right"><?php echo number_format($subtotal['match']); ?></td>
            <td align="right" style="color:#880000;"><?php echo number_format($pph['match']); ?></td>
            <td align="right" style="color:#880000;"><?php echo number_format($adm['match']); ?></td>
            <td align="right"><strong><?php echo number_format($total['match']); ?></strong></td>
        </tr>
        <tr>
            <td><strong>Bonus Sharing Couple</strong></td>
            <td align="right"><?php echo number_format($bonus['gen_match']); ?></td>
            <td align="right" style="color:#880000;"><?php echo number_format($cut_index['gen_match']); ?></td>
            <td align="right"><?php echo number_format($subtotal['gen_match']); ?></td>
            <td align="right" style="color:#880000;"><?php echo number_format($pph['gen_match']); ?></td>
            <td align="right" style="color:#880000;"><?php echo number_format($adm['gen_match']); ?></td>
            <td align="right"><strong><?php echo number_format($total['gen_match']); ?></strong></td>
        </tr>
        <tr>
            <td><strong>Bonus Spillover</strong></td>
            <td align="right"><?php echo number_format($bonus['matrix_node']); ?></td>
            <td align="right" style="color:#880000;"><?php echo number_format($cut_index['matrix_node']); ?></td>
            <td align="right"><?php echo number_format($subtotal['matrix_node']); ?></td>
            <td align="right" style="color:#880000;"><?php echo number_format($pph['matrix_node']); ?></td>
            <td align="right" style="color:#880000;"><?php echo number_format($adm['matrix_node']); ?></td>
            <td align="right"><strong><?php echo number_format($total['matrix_node']); ?></strong></td>
        </tr>
        <tr>
            <td><strong>Bonus Prestasi Warehouse</strong></td>
            <td align="right"><?php echo number_format($bonus['gen_node_extra_warehouse']); ?></td>
            <td align="right" style="color:#880000;"><?php echo number_format($cut_index['gen_node_extra_warehouse']); ?></td>
            <td align="right"><?php echo number_format($subtotal['gen_node_extra_warehouse']); ?></td>
            <td align="right" style="color:#880000;"><?php echo number_format($pph['gen_node_extra_warehouse']); ?></td>
            <td align="right" style="color:#880000;"><?php echo number_format($adm['gen_node_extra_warehouse']); ?></td>
            <td align="right"><strong><?php echo number_format($total['gen_node_extra_warehouse']); ?></strong></td>
        </tr>
        <tr>
            <td><strong>Bonus Prestasi Factory</strong></td>
            <td align="right"><?php echo number_format($bonus['gen_node_extra']); ?></td>
            <td align="right" style="color:#880000;"><?php echo number_format($cut_index['gen_node_extra']); ?></td>
            <td align="right"><?php echo number_format($subtotal['gen_node_extra']); ?></td>
            <td align="right" style="color:#880000;"><?php echo number_format($pph['gen_node_extra']); ?></td>
            <td align="right" style="color:#880000;"><?php echo number_format($adm['gen_node_extra']); ?></td>
            <td align="right"><strong><?php echo number_format($total['gen_node_extra']); ?></strong></td>
        </tr>
        <tr>
            <td><strong>Bonus Level Board</strong></td>
            <td align="right"><?php echo number_format($bonus['board_level']); ?></td>
            <td align="right" style="color:#880000;"><?php echo number_format($cut_index['board_level']); ?></td>
            <td align="right"><?php echo number_format($subtotal['board_level']); ?></td>
            <td align="right" style="color:#880000;"><?php echo number_format($pph['board_level']); ?></td>
            <td align="right" style="color:#880000;"><?php echo number_format($adm['board_level']); ?></td>
            <td align="right"><strong><?php echo number_format($total['board_level']); ?></strong></td>
        </tr>
        <tr>
            <td><strong>Bonus Cycle Board</strong></td>
            <td align="right"><?php echo number_format($bonus['board_fly']); ?></td>
            <td align="right" style="color:#880000;"><?php echo number_format($cut_index['board_fly']); ?></td>
            <td align="right"><?php echo number_format($subtotal['board_fly']); ?></td>
            <td align="right" style="color:#880000;"><?php echo number_format($pph['board_fly']); ?></td>
            <td align="right" style="color:#880000;"><?php echo number_format($adm['board_fly']); ?></td>
            <td align="right"><strong><?php echo number_format($total['board_fly']); ?></strong></td>
        </tr>
        <tr>
            <td><strong>Bonus DRP</strong></td>
            <td align="right"><?php echo number_format($bonus['sponsor_upgrade']); ?></td>
            <td align="right" style="color:#880000;"><?php echo number_format($cut_index['sponsor_upgrade']); ?></td>
            <td align="right"><?php echo number_format($subtotal['sponsor_upgrade']); ?></td>
            <td align="right" style="color:#880000;"><?php echo number_format($pph['sponsor_upgrade']); ?></td>
            <td align="right" style="color:#880000;"><?php echo number_format($adm['sponsor_upgrade']); ?></td>
            <td align="right"><strong><?php echo number_format($total['sponsor_upgrade']); ?></strong></td>
        </tr>
        <tr class="title">
            <td><strong>TOTAL</strong></td>
            <td align="right"><?php echo number_format($total['bonus']); ?></td>
            <td align="right" style="color:#880000;"><?php echo number_format($total['cut_index']); ?></td>
            <td align="right"><?php echo number_format($total['subtotal']); ?></td>
            <td align="right" style="color:#880000;"><?php echo number_format($total_pph); ?></td>
            <td align="right" style="color:#880000;"><?php echo number_format($total_adm); ?></td>
            <td align="right"><strong><?php echo number_format($total['total']); ?></strong></td>
        </tr>
    </table>
</div>